home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
GameStar 2006 February
/
Gamestar_81_2006-02_dvd.iso
/
Red Shark
/
Missions
/
Mission_5
/
Mission.script
< prev
next >
Wrap
Text File
|
2002-01-31
|
6KB
|
227 lines
//-------------------------------------------------------------------
//
// This code is copyright 2001 by G5 Software.
// Any unauthorized usage, either in part or in whole of this code
// is strictly prohibited. Violators WILL be prosecuted to the
// maximum extent allowed by law.
//
//-------------------------------------------------------------------
class CClearVillageMission extends
CBaseMission, CClearVillageMissionObjectList, CClearVillageMission_Strings, CNavPointUser
{
int GetAutoGeneratedUnitsQty()
{
return 6;
}
void CClearVillageMission()
{
BaseMission_InitMission();
BaseMission_UpdateLoadProgress();
CreateComponent("DebugCamera", "GameObject", "CDebugCamera");
SetComponentPosition("DebugCamera",
matrix(
1.0, 0.0, 0.0, 8000.0,
0.0, 1.0, 0.0, 8000.0,
0.0, 0.0, 1.0, 600.0,
0.0, 0.0, 0.0, 1.0
));
// CreateComponent(IDToRegister, ComponentID, ScriptName | FileName | "")
BaseMission_UpdateLoadProgress();
CreateComponent("Atmosphere", "Atmosphere", "CClearVillageMission_Atmosphere");
BaseMission_UpdateLoadProgress();
CreateComponent("Sky", "SkyObject", "CClearVillageMission_Sky");
BaseMission_UpdateLoadProgress();
CreateComponent("Terrain", "ProgressiveTerrainObject", "CClearVillageMission_Terrain");
BaseMission_UpdateLoadProgress();
CreateComponent("Forest", "Forest", "CClearVillageMission_Forest");
BaseMission_UpdateLoadProgress();
CreateComponent("AIController", "AIController", "CBaseAIController");
BaseMission_CreateObjects();
m_EnemyUnitsCount = 0;
array m_Objects = GetObjectsIDs();
for (int i = 0; i < m_Objects.size(); i = i + 1)
{
if (Core_IsStringStartsWith(m_Objects[i], "Nazi"))
m_EnemyUnitsCount = m_EnemyUnitsCount + 1;
}
m_EnemyStructuresCount =
Core_CallFunction(
"Village_09",
"GetObjectsQuantity",
"CBaseGermanTent"
) +
Core_CallFunction(
"Village_09",
"GetObjectsQuantity",
"CBaseGermanArmedDoubleHouse"
) +
Core_CallFunction(
"Village_09",
"GetObjectsQuantity",
"CBaseGermanArmedSingleHouse"
) +
Core_CallFunction(
"Village_09",
"GetObjectsQuantity",
"CBaseGermanGunTower"
);
m_FriendlyStructuresDestroyed = 0;
}
int m_EnemyUnitsCount;
int m_EnemyStructuresCount;
int m_FriendlyStructuresDestroyed;
int OBJECTIVE_CLEAN_UP = 0;
int OBJECTIVE_KEEP_CIVILIAN_STRUCTURES = 1;
array m_MissionObjectivesStatuses =
array(
str_ObjectiveInProgress,
str_ObjectiveInProgress
);
array m_BonusMissionObjectivesStatuses =
array();
//
// 'virtual' methods
//
//
// Mission statistics
string GetMissionStatistics()
{
return str_StatisticsTitle;
}
//
// Mission navpoints
array GetNavPoints()
{
array navpoints =
array(
GetNavPoint("NavPoint_Vasyuki"),
GetNavPoint("NavPoint_Marshevka"),
GetNavPoint("NavPoint_Gotovtsevo"),
GetNavPoint("NavPoint_Barinovo"),
GetNavPoint("NavPoint_Upyryovka"),
GetNavPoint("NavPoint_Korzhebino"),
GetNavPoint("NavPoint_Ovechkino"),
GetNavPoint("NavPoint_Gerasimovo"),
GetNavPoint("NavPoint_Ozerino")
// vector(7967.0, 8364.0, 600.0),
// vector(2017.0, 3896.0, 0.0),
// vector(3880.0, 12547.0, 600.0),
// vector(11864.0, 13886.0, 600.0),
// vector(11133.0, 11016.0, 600.0),
// vector(14715.0, 10547.0, 600.0),
// vector(13622.0, 4694.0, 600.0),
// vector(11463.0, 3015.0, 600.0),
// vector(7205.0, 3563.0, 600.0)
);
return navpoints;
}
//
// Mission map skin file
string GetMapSkinFileName()
{
return "Missions/Mission_5/Map.skin";
}
//
// Mission specific event handlers
//
//
// Object destroyed event handler
//
void OnGameObjectDestroyed(string _id)
{
BaseMission_OnGameObjectDestroyed(_id);
// check for destroyed enemy building
if (Core_IsStringStartsWith(_id, "Village_09_CBaseGermanArmedSingleHouse") ||
Core_IsStringStartsWith(_id, "Village_09_CBaseGermanArmedDoubleHouse") ||
Core_IsStringStartsWith(_id, "Village_09_CBaseGermanTent") ||
Core_IsStringStartsWith(_id, "Village_09_CBaseGermanGunTower"))
{
m_EnemyStructuresCount = m_EnemyStructuresCount - 1;
Core_BroadcastEvent(
"OnDisplayMessage",
str_EnemyDestroyedMsg,
m_GoodNewsColor
);
}
else
if (Core_IsStringStartsWith(_id, "Village_09"))
{
// sheafs are not civil structures
if (Core_IsStringStartsWith(_id, "Village_09_CBaseSheaf") ||
Core_IsStringStartsWith(_id, "Village_09_CBaseBigSheaf"))
{
return;
}
m_FriendlyStructuresDestroyed = m_FriendlyStructuresDestroyed + 1;
Core_BroadcastEvent(
"OnDisplayMessage",
str_CivilianDestroyedMsg,
m_BadNewsColor
);
Core_SendEventTo(
"Helicopter",
"ShowEventObject",
_id, // - id of object to show
250.0 // - distance from camera to object
);
}
if (Core_IsStringStartsWith(_id, "Nazi"))
{
m_EnemyUnitsCount = m_EnemyUnitsCount - 1;
}
if (m_FriendlyStructuresDestroyed == 4) // maximum 3 civilian buildings can be destroyed
{
BaseMission_FailObjective(OBJECTIVE_KEEP_CIVILIAN_STRUCTURES);
BaseMission_DelayedQuit();
}
if (m_EnemyStructuresCount == 0 && m_EnemyUnitsCount == 0)
{
BaseMission_CompleteObjective(OBJECTIVE_KEEP_CIVILIAN_STRUCTURES);
BaseMission_CompleteObjective(OBJECTIVE_CLEAN_UP);
}
}
void OnMissionLoaded()
{
Core_SendEventTo("Helicopter", "OnInitiallyEnableTargetScreen", false);
// Start mission music playing
Core_SendEventTo(SOID_MusicController, "PlayMissionMusic", 5);
}
}